pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple

# 检查 LLaMA-Factory 目录是否存在且包含 README.md
if [ -d "LLaMA-Factory" ] && [ -f "LLaMA-Factory/README.md" ]; then
    echo "LLaMA-Factory already exists and contains README.md, skipping installation..."
else
    echo "Installing LLaMA-Factory..."
    git clone --depth 1 https://gitee.com/hiyouga/LLaMA-Factory.git
    cd LLaMA-Factory
    pip install -e ".[torch,metrics]" --no-build-isolation
    cd ..
fi

pip install modelscope
pip install vllm
pip install deepspeed==0.16.9

modelscope download --model Qwen/Qwen3-4B

cp -r ./configs ./LLaMA-Factory/configs
cp -f -r ./data ./LLaMA-Factory

apt update

chmod +x "run.sh"